<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class GoodsViewLog extends Model
{
    //add new record in log
    public function addLog($gid,$ip){
        $this->insert(['gid'=>$gid,'ip'=>$ip]);
    }

    //get ipList for every ip
    public function getGids($ip){
      return $this->where('ip',$ip)->orderBy('updated_at','DESC')->groupBy('gid')->lists('gid')->toArray();
    }

}
